/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.s2aei.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Christian
 */
@Entity
@Table(name = "Avaliador")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Avaliador.findAll", query = "SELECT a FROM Avaliador a"),
    @NamedQuery(name = "Avaliador.findByAvaliadorId", query = "SELECT a FROM Avaliador a WHERE a.avaliadorId = :avaliadorId"),
    @NamedQuery(name = "Avaliador.findByArea", query = "SELECT a FROM Avaliador a WHERE a.area = :area"),
    @NamedQuery(name = "Avaliador.findByFormacao", query = "SELECT a FROM Avaliador a WHERE a.formacao = :formacao")})
public class Avaliador implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "avaliador_Id")
    private Integer avaliadorId;
    @Basic(optional = false)
    @Column(name = "area")
    private String area;
    @Basic(optional = false)
    @Column(name = "formacao")
    private String formacao;
    @JoinColumn(name = "avaliador_Id", referencedColumnName = "user_Id", insertable = false, updatable = false)
    @OneToOne(optional = false)
    private Usuario usuario;

    public Avaliador() {
    }

    public Avaliador(Integer avaliadorId) {
        this.avaliadorId = avaliadorId;
    }

    public Avaliador(Integer avaliadorId, String area, String formacao) {
        this.avaliadorId = avaliadorId;
        this.area = area;
        this.formacao = formacao;
    }

    public Integer getAvaliadorId() {
        return avaliadorId;
    }

    public void setAvaliadorId(Integer avaliadorId) {
        this.avaliadorId = avaliadorId;
    }

    public String getArea() {
        return area;
    }

    public void setArea(String area) {
        this.area = area;
    }

    public String getFormacao() {
        return formacao;
    }

    public void setFormacao(String formacao) {
        this.formacao = formacao;
    }

    public Usuario getUsuario() {
        return usuario;
    }

    public void setUsuario(Usuario usuario) {
        this.usuario = usuario;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (avaliadorId != null ? avaliadorId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Avaliador)) {
            return false;
        }
        Avaliador other = (Avaliador) object;
        if ((this.avaliadorId == null && other.avaliadorId != null) || (this.avaliadorId != null && !this.avaliadorId.equals(other.avaliadorId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.s2aei.model.Avaliador[ avaliadorId=" + avaliadorId + " ]";
    }
    
}
